import {Modal} from "antd"
import ProTable from "@ant-design/pro-table";
import {getOrderRecord} from "@/services/ant-design-pro/order";

const OrderRecordModal = (props) => {
      const {visible,setVisible ,id} = props
      const columns = [
      {
          title: '订单ID',
          width: 120,
          dataIndex: 'order_id',
          align: 'center'
      },
      {
          title: '操作记录',
          dataIndex: 'change_message',
          width: 300,
          align: 'center'
      },
      {
          title: '操作时间',
          dataIndex: 'created_at',
          align: 'center',
          width: 120
      }]

      return (
          <Modal
              visible={ visible }
              onCancel={()=>{ setVisible(false) }}
              title="订单记录"
              width={700}
          >
              <ProTable
                  columns={columns}
                  options={false}
                  search={false}
                  request={ async ()=>{
                      let {order_logs} = await getOrderRecord(id)
                      return{
                          data : order_logs
                      }
                  }}
                  dateFormatter="string"
                  rowKey="id"
              />
          </Modal>
      );
};

export default OrderRecordModal;
